﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ViVa.ActiveDirectory;

namespace ViVa_Portal.Controllers
{
    public class AdminController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.LogList = DataFiller<Logging>.FromDataTableToList(Logging.getLog(1, true));
            return View(DataFiller<Links>.FromDataTableToList(Links.getLinks()));
        }

        public ActionResult verwijderLink(Links link)
        {
            Links.verwijderLink(link);
            return RedirectToAction("Index");
        }

        [HttpGet]
        public ActionResult voegLinkToe(string link_Type)
        {
            ViewBag.LogList = DataFiller<Logging>.FromDataTableToList(Logging.getLog(1, true));
            return View(new Links { Link_Type = link_Type });
        }

        [HttpPost]
        public ActionResult voegLinkToe(Links link)
        {
            Links.addLink(link);
            return RedirectToAction("Index");
        }
    }
}
